package com.wufeng.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wufeng.dto.ChatRecordDto;
import com.wufeng.entity.ChatRecord;
import com.wufeng.service.ChatRecordService;
import com.wufeng.mapper.ChatRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Hxh
* @description 针对表【chat_record】的数据库操作Service实现
* @createDate 2024-01-02 23:12:58
*/
@Service
public class ChatRecordServiceImpl extends ServiceImpl<ChatRecordMapper, ChatRecord>
    implements ChatRecordService{

    @Autowired
    private ChatRecordMapper chatRecordMapper;

    @Override
    public List<ChatRecordDto> getChatRecordByCondition(List<Integer> userIds, String message, Integer pageIndex, Integer pageSize) {

        Integer startIndex = (pageIndex-1) * pageSize;
        return chatRecordMapper.getChatRecordByCondition(userIds,message,startIndex, pageSize);
    }

    @Override
    public Integer countChatRecordByCondition(List<Integer> userIds, String message) {
        return chatRecordMapper.countChatRecordByCondition(userIds,message);
    }
}




